package com.midou.administration.controller;

import com.midou.administration.entity.ServiceMessage;
import com.midou.administration.service.ServiceMessageService;
import com.midou.administration.utils.WebSocketServlet;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/service/message")
public class ServiceMessageController {
    @Resource
    private ServiceMessageService serviceMessageService;
    @RequestMapping("/inst/message")
    public Integer instMessage(@RequestBody ServiceMessage sm){
        return serviceMessageService.insertMessage(sm);
    }
    @RequestMapping("/query/message")
    public List<ServiceMessage> queryMessage(@RequestBody Integer bid){
        return serviceMessageService.queryMessage(bid);
    }
    @RequestMapping("/query/count")
    public Integer queryCount(@RequestBody ServiceMessage sm){
        return serviceMessageService.queryCount(sm.getBuId(),sm.getSmIfDealWith());
    }
    @RequestMapping("/modify/message/state")
    public Integer modifyMessageState(@RequestBody ServiceMessage sm){
        return serviceMessageService.modifyMessageState(sm);
    }
}
